//
//  CarsViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/26.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "CarsViewModel.h"
#import "CarsModel.h"
#import "CarsGroupModel.h"

@implementation CarsViewModel

-(void)getDatasArraySuccess:(void (^)())completion{
    //{db:"apilkoa",SqlNo:"65"}
    NSDictionary *info = @{@"db":@"apilkoa",@"SqlNo":@"65"};
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,COMMON_URL];
    [NetWorker getCommonDatasWithURLStr:url body:info success:^(id result) {
        NSArray *arr = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *modelArr = [NSMutableArray array];
        for (NSDictionary *dic in arr) {
            CarsModel *cars = [CarsModel yy_modelWithDictionary:dic];
            CarsGroupModel *model = [CarsGroupModel initWith:cars];
            [modelArr addObject:model];
        }
        _datasArray = [NSArray arrayWithArray:modelArr];
        completion();
    } failure:^(id result) {
    }];

}

@end
